#include <QtGui/QApplication>

#include "qprojectloader.h"

#include "../../libs/sharedLib/pluginloader.h"
#include "../../libs/sharedlib/qprojectcore.h"

#include <QFont>
#include <QMessageBox>
#include <QTextCodec>

#include "qdeviceapplication.h"

int main(int argc, char *argv[])
{
    QDeviceApplication a(argc, argv);


    QTextCodec *gbk = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForTr(gbk);
    QTextCodec::setCodecForLocale(gbk);
    QTextCodec::setCodecForCStrings(gbk);

    QFont f=a.font();
    f.setFamily("Arial");
    a.setFont(f);

    QString str;
    int index;
    bool isUpdate;
    bool success;
    for(int i=0;i<argc;i++)
    {
        str=argv[i];
        index=str.indexOf("=");
        if(index>0)
        {
            if(str.left(index)=="update")
            {
                isUpdate=true;
                success=(str.mid(index+1)=="true");
            }
        }
    }

    SHAREDLIB::PluginLoader::getPluginLoader()->loadPropertyPlugin();
    SHAREDLIB::PluginLoader::getPluginLoader()->loadWidgetPlugin();
    SHAREDLIB::PluginLoader::getPluginLoader()->loadSharedPlugin();

    QProjectLoader loader;
    loader.run();

    a.exec();
    SHAREDLIB::PluginLoader::releasePluginLoader();
    return 0;
}
